import request from '@/utils/request'

export const query = (parms) => {
  return request({
    url: '/realtime',
    method: 'get',
    params: parms
  })
}

// 保存
export const save = (data) => {
  return request({
    url: '/realtime',
    method: 'post',
    data: data
  })
}

export const updateTerminal = (id, data) => {
  return request({
    url: '/realtime/' + id + '/update',
    method: 'post',
    data: data
  })
}

export const queryVersion = (id) => {
  return request({
    url: '/realtime/' + id + '/version',
    method: 'get'
  })
}

export const getById = (id) => {
  return request({
    url: '/realtime/' + id,
    method: 'get'
  })
}

export const getRealTimeById = (id) => {
  return request({
    url: '/battery/realTime/' + id,
    method: 'get'
  })
}

export const getHistoryByVin = (page, vin) => {
  return request({
    url: '/battery/getAllHistory/' + vin,
    method: 'get',
    params: page
  })
}

export const getCount = () => {
  return request({
    url: '/realtime/count',
    method: 'get'
  })
}
/**
 * 获取所有最新的日志数据，感觉直接在前端取数据比较方便
 */
export const getAllForMap = () => {
  return request({
    url: '/realtime/getAllForMap',
    method: 'get'
  })
}
